package com.gxuwz.ssy.service.impl;

import com.gxuwz.ssy.model.User;
import com.gxuwz.ssy.mapper.UserMapper;
import com.gxuwz.ssy.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 师善滢
 * @since 2022-04-06
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
    public Integer login(String username,String pwd){
        User u =  this.query().eq("account",username).eq("pwd",pwd).one();
        Integer[] res = new Integer[1];
        Optional.ofNullable(u).ifPresent(e->res[0] = e.getId());
        return res[0];
    }
}
